<% //macro paginate currentPage totalPage totalRow actionUrl urlParas=""%>
<%
if (totalPage <= 0 || currentPage > totalPage) return;
var startPage = currentPage - 4;
if(startPage<1){
  startPage=1;
}
var endPage = currentPage+4;
if(endPage>totalPage){
  endPage = totalPage;
}
%>

<div class="list-page">
  <span>共${totalRow}条记录</span>
  <%
  if(currentPage <= 8){
    startPage = 1;
  }
  if(totalPage-currentPage < 8){
    endPage = totalPage;
  }
  if(currentPage == 1){
  %>
    <span class="disabled prev_page">上页</span>
  <%}else{%>
    <a href="${actionUrl}" class="prev_page">上页</a>
  <%}%>

  <%if(currentPage > 8){%>
  <a href="${actionUrl}1${urlParas!}">1</a>
  <a href="${actionUrl}2${urlParas!}">2</a>
  <span class="gap">...</span>
  <%}%>

  <%
  var index = startPage;
  while(index<=endPage){%>
    <%if(currentPage == index){%>
      <span class="current">${index}</span>
    <%}else{%>
      <a href="${actionUrl+index}${urlParas!}">${index}</a>
    <%}%>
  <%
    index= index+1;
  }%>


  <%if((totalPage - currentPage) >= 8){%>
    <span class="gap">…</span>
    <a href="${actionUrl}${totalPage - 1}${urlParas!}">${totalPage - 1}</a>
    <a href="${actionUrl}${totalPage}${urlParas!}">${totalPage}</a>
  <%}%>

  <%if(currentPage == totalPage){%>
    <span class="disabled next_page">下页</span>
  <%}else{%>
    <a href="${actionUrl}${currentPage + 1}${urlParas!}" class="next_page" rel="next">下页</a>
  <%}%>
</div>
